package com.net.service.sell.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.net.dao.sell.SellBackMainDao;
import com.net.model.Commodity;
import com.net.model.Customer;
import com.net.model.SellBackDetail;
import com.net.model.SellBackMain;
import com.net.service.sell.SellBackMainService;

@Component("sellBackMainService")
public class SellBackMainServiceImpl implements SellBackMainService {

	private SellBackMainDao sellBackMainDao;
	
	public void add(SellBackMain sellBackMain) {
		sellBackMainDao.save(sellBackMain);
	}

	public boolean delete(SellBackMain sellBackMain) {
		return sellBackMainDao.delete(sellBackMain);
	}

	public int getCount() {
		return sellBackMainDao.getCount();
	}

	public List<SellBackMain> getSellBackMains(int currentPage, int perPage,
			String orderType, String orderName) {
		return sellBackMainDao.getSellBackMains(currentPage, perPage, orderType, orderName);
	}

	public List<SellBackMain> getSellBackMainsByCondition(int currentPage,
			int perPage, String condition) {
		return sellBackMainDao.getSellBackMainsByCondition(currentPage, perPage, condition);
	}

	public SellBackMain loadSellBackMainById(int id) {
		return sellBackMainDao.loadSellBackMainById(id);
	}

	public SellBackMain loadSellBackMainByName(String name) {
		return sellBackMainDao.loadSellBackMainByName(name);
	}

	public void update(SellBackMain sellBackMain) {
		sellBackMainDao.update(sellBackMain);
	}

	public SellBackMainDao getSellBackMainDao() {
		return sellBackMainDao;
	}
	@Resource(name="sellBackMainDao")
	public void setSellBackMainDao(SellBackMainDao sellBackMainDao) {
		this.sellBackMainDao = sellBackMainDao;
	}

	/****/
	
	public List<SellBackMain> getSellBackMains(){
		
		return sellBackMainDao.getSellBackMains();
	}

	public Commodity getCommodityByName(String name) {
		
		return sellBackMainDao.getCommodityByName(name);
	}

	public Customer getCustomerByName(String customerName) {
		return sellBackMainDao.getCustomerByName(customerName);
	}

	public void add(SellBackDetail sb) {
		sellBackMainDao.add(sb);
	}

	public void add(SellBackMain sellBackMain, List<Commodity> commoditys,
			Customer customer, List<SellBackDetail> sellBackDetails) {
		sellBackMainDao.save(sellBackMain,commoditys,customer,sellBackDetails);
	}

	public SellBackMain getSellBackMainById(int id) {
		return sellBackMainDao.getSellBackMainById(id);
	}

	public void update(SellBackMain sellBackMain, List<Commodity> commoditys,
			Customer customer, List<SellBackDetail> sellBackDetails) {
		sellBackMainDao.update(sellBackMain,commoditys,customer,sellBackDetails);
	}
}
